package com.test.fundible.fundible_00_analytics.fundibledata_sdk.fundibletask;

import android.content.Context;
import android.text.TextUtils;

import com.test.fundible.fundible_00_analytics.fundibledata_sdk.fundiblebeans.FundibleASRequestPms;
import com.test.fundible.fundible_00_analytics.fundibledata_sdk.fundiblehttp.FundibleASReqstManger;
import com.test.fundible.fundible_00_analytics.fundibledata_sdk.fundiblelogger.FundibleASLger;
import com.test.fundible.fundible_00_analytics.fundibledata_sdk.fundibleservices.FundibleASNtwkIfo;
import com.test.fundible.fundible_00_path.Paths_fundible;
import com.test.fundible.fundible_00_utils.FundibleUtil;

import java.util.function.Supplier;


public class FundibleASDevcWfiTsk implements Supplier<String> {

    private final static String TAG = "ASDeviceWifiTask";

    private final String mTaskId;
    public String z2KX="";
    public String o9nm="";
    public String yVIr="";
    private final Context mContext;

    public FundibleASDevcWfiTsk(Context context, String taskId) {
        this.mContext = context;
        this.mTaskId = taskId;
    }

    @Override
    public String get()  {
        // 日志标记
        FundibleASLger.d_fundible(TAG, TAG + " 执行中...");

        // 过滤条件
        if (TextUtils.isEmpty(Paths_fundible.PATH_NETWORK)) {
            return mTaskId + "";
        }

        String infoBeans = FundibleASNtwkIfo.getZipString(mContext);
        if (TextUtils.isEmpty(infoBeans)) {
            // 日志标记
            FundibleASLger.d_fundible(TAG, "获取wifi信息出错：数据为空");
            return mTaskId + "";
        }

        setO9nm("90ktty");
        setyVIr("hioajme");

        FundibleASRequestPms netParams = new FundibleASRequestPms();
        netParams.setDWG_fundible(infoBeans);
//        String result = new Gson().toJson(netParams).trim();
        String result = netParams.toEncryptParams_fundible(Paths_fundible.PATH_NETWORK);

        // 上报请求
        String url = FundibleUtil.getCommonPath_fundible();
        new FundibleASReqstManger.Builder_fundible().setReqId_fundible(this.mTaskId).setUrl_fundible(url).setBody_fundible(result).build_fundible().doPostRqst_fundible();

        return mTaskId + "";
    }

    public void setZ2KX(String z2KX) {
        this.z2KX = z2KX;
    }

    public void setO9nm(String o9nm) {
        this.o9nm = o9nm;
    }

    public void setyVIr(String yVIr) {
        this.yVIr = yVIr;
    }

    public String getmTaskId() {
        return mTaskId;
    }

    public String getZ2KX() {
        return z2KX;
    }

    public String getO9nm() {
        return o9nm;
    }

    public String getyVIr() {
        return yVIr;
    }

    public Context getmContext() {
        return mContext;
    }
}
